home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
jazclib1.arc
/
JZGETFCB.C
< prev
next >
Wrap
Text File
|
1986-04-05
|
1KB
|
54 lines
jzgetfcb( ffcb , fname , fdosdrive)
TFCB *ffcb;
char *fname;
int fdosdrive;
{
char wdta[44]; /* dta buffer */
TFCB wfcb; /* dummy fcb for function call */
int wdtaseg,wdtaofs; /* hold orig dta address */
char *strchr(),*w;
char wname[9],wext[4]; /* place holders */
TREG wreg;
jzgetdta(&wdtaofs,&wdtaseg); /* get old dta */
jzsetdta(wdta); /* set new dta address */
memset(ffcb,' ',sizeof(TFCB)); /* fill with spaces */
ffcb->flag = 0xFF;
ffcb->attr = 7;
ffcb->drive= fdosdrive;
w = strchr(fname,'.');
if (w) {
strncpy(wname,fname,w - fname);
wname[w-fname] = 0; /* terminate string */
strcpy(wext,fname + (w - fname) + 1);
}
else {
strcpy(wname,fname);
wext[0] = 0;
}
memcpy(ffcb->name,wname,strlen(wname));
memcpy(ffcb->ext ,wext ,strlen(wext ));
wreg.h.ah = 0x11; /* get first file function */
wreg.x.ds = getds();
wreg.x.dx = (int) ffcb; /* get seg:off pointer to fcb */
msdos(&wreg);
if (wreg.h.al == 0xff)
return(-1);
memcpy(ffcb,wdta,sizeof(TFCB)); /* get info into return var */
jzsetdta(wdtaofs); /* restore orig dta */
return(0);
}